#pragma once

#include <exception>
#include <vector>

namespace TUMAR { namespace CountryRoads {
	enum TileTypeEnum 
	{
		Empty,
		Border,
		RoadStraight,
		RoadCurve,
		ObstacleStone,
		ObstacleHayBail,
		ObstacleTree
	} typedef TileType;
	
	class Tile
	{
	private:
		TileType type;
	public:
		int Position[2];
		int Orientation;

		Tile(void);
		Tile(const Tile& copy);
		virtual ~Tile(void);

		TileType GetType(void) const;
		virtual void SetType(TileType type);

		virtual void Reset(void);
	};
	
	class UserTile : public Tile
	{
	public:
		bool Conflict;

		UserTile(void);
		virtual ~UserTile(void);
	};
	
	class Character
	{
	public:
		int Position[2];
		int Orientation;

		void changePosition(bool x, bool up, int orientation);
		void initPosition(int x, int y, int orientation);
		Character(void);
		~Character(void);
	};
	
	class GameBoard
	{
	private:
		int width;
		int height;
		
		std::vector<Tile> tiles;
	public:
		Tile* StartTile;
		Tile* EndTile;
		Character* Character;

		std::vector<UserTile> UserTiles;

		GameBoard(int width, int height);
		~GameBoard(void);

		void Reset(void);

		int GetWidth(void) const;
		int GetHeight(void) const;

		Tile* GetTile(int x, int y);		
		const Tile* GetTile(int x, int y) const;
	};

}}